﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace ExamSharedClasses
{
    
    /// <summary>
    /// (k) Course ist die Vorlage für eine (Schul-)Klasse. Diese Objekt stellt die Basis
    /// für die Klasse dar und entspricht der gleichnamigen Datenbanktabelle.
    /// </summary>
    [Serializable()]
    public class Course 
    {
        public const String TABLENAME = "course";
        public const String COURSE_ID = "course_id";
        public const String COURSE_NAME = "course_name";

        public int CourseId { get; set; }
        public String CourseName { get; set; }

        public Course()
        {
            this.CourseId = -1;
            this.CourseName = "";
        }
        public Course(int courseId, String courseName)
        {
            this.CourseId = courseId;
            this.CourseName = courseName;
        }
        public Course(Course course) {
            this.CourseId = course.CourseId;
            this.CourseName = course.CourseName;
        }

        public int CompareTo(object obj)
        {
            return (CourseId.CompareTo(((Course)obj).CourseId));
        }

        public override string ToString() {
            StringBuilder sb = new StringBuilder( "Course: " );
            sb.Append( "ID: " + CourseId.ToString() + ", " );
            if ( CourseName != null )
                sb.Append( "NAME: " + CourseName.ToString() + '\n' );
            return sb.ToString();
        }

    }
}
